<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Syncme - Sign Up</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<script type="text/javascript" src="js/jquery-1.9.0.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<!-- inclusao do css -->

<style type="text/css">

html,body{ height:100%; }
</style>
</head>
<body>

<div class="well" id="login">
    <form id="target">
    <fieldset>
    <legend>SIGN UP</legend>
    <label>E-mail</label>
    <input type="hidden" id="opt" name="opt" value="SIGNUP">
    <input type="hidden" id="id" name="id" value="0">
    <input type="text" placeholder="email" class="required email" id="email" name="email">
    <label>Password</label>
    <input type="password" placeholder="password" id="password"  class="required" name="password">
    <div>
    <button type="submit" class="btn">Submit</button>
    </div>
    </fieldset>
    
    </form>
    <a href="index.html">BACK TO HOME</a>
    <a class="btn btn-primary" href="files/SyncmeAndroid.apk">Download Android Version</a>
</div>


<script type="text/javascript">
var ScreenController = {
		module:"syncme",
		listener:"ProfileListener.php",
		
		init:function(){
	
			/*$.ajax({
				type:"POST",
				dataType:"json",
				url:ScreenController.module+"/"+ScreenController.listener ,
				data:"opt=SAY_HI", 
				success: function(response) {
					
					alert(response.msg);
				}
			});
			
			$.ajax({
				type:"POST",
				dataType:"json",
				url:ScreenController.module+"/"+ScreenController.listener,
				data:"opt=SAY_HELLO&name=Ivan", 
				success: function(response) {
					alert(response.msg);
				}
			});*/

		}
};

$(function(){
	$( "#target" ).submit(function( event ) {
		
		var test = $("#target").valid();

		if(test){
		$.ajax({
			type:"POST",
			dataType:"json",
			url:ScreenController.module+"/"+ScreenController.listener,
			data:$('#target').serialize(), 
			success: function(response) {
				
				if(response.error!=0  && response.error!=undefined){
					alert(response.msgError);
					
				}else{
					alert(response.msg);
					window.location = "index.html";
			        }
			}
		});
		}
		
		event.preventDefault();
		});
});



ScreenController.init();

	
</script>
</body>
</html>